import { ArticleModel } from '@/api/cms/article/ArticleModel'
import { reactive } from 'vue'

export default function useBaseModel() {
    //表单绑定的数据
    const addModel = reactive<ArticleModel>({
        id: '',
        editType: '',
        title: '',
        status: '1',
        edit_id: '',
        tag: [],
        img: '',
        key_word: '',
        category_id: 1,
        description: '',
        content: ''
    })
    //表单验证规则
    const rules = reactive({
        title: [
            {
                required: true,
                trigger: 'change',
                message: '请填写文章标题'
            }
        ],
        category_id: [
            {
                required: true,
                trigger: 'change',
                message: '请选择分类'
            }
        ],
        status: [
            {
                required: true,
                trigger: 'change',
                message: '请选择状态'
            }
        ],
        img: [
            {
                required: true,
                trigger: 'change',
                message: '请上传图片'
            }
        ]
        // content: [
        //     {
        //         required: true,
        //         trigger: 'change',
        //         message: '请填写文章内容'
        //     }
        // ]
    })

    return {
        addModel,
        rules
    }
}
